# coding:utf-8

import os
import split
import train

def main():
    data_dir = os.path.join(os.getcwd(), 'data')
    svm_model_file = os.path.join(data_dir, 'svm_model.txt')
    test_dir = os.path.join(os.getcwd(), 'test')
    for file in os.listdir(test_dir):
        file_name = os.path.join(test_dir, file)
        filenames = split.split_one_file(file_name)
        results = []
        for f in filenames:
            status,code = train.model_test_for_file(svm_model_file, f)
            if status is True:
                results.append(code)
        print ''.join(results)


if __name__ == '__main__':
    main()